//
//  SmallDecisionsXjdEditTemplateItemCell.m
//  SmallDecisions
//
//  Created by 李付雄 on 2025/8/4.
//

#import "SmallDecisionsXjdEditTemplateItemCell.h"

@interface SmallDecisionsXjdEditTemplateItemCell()

@property (nonatomic, strong) UIView *contianerBgView;

@end
@implementation SmallDecisionsXjdEditTemplateItemCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style
              reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor clearColor];
        
        [self createSmallDecisionsXjdEditTemplateItemCellSubviews];
    }
    return self;
}

- (void)createSmallDecisionsXjdEditTemplateItemCellSubviews {
    [self contianerBgView];
    [self textField];
}

- (UIView *)contianerBgView {
    if(!_contianerBgView) {
        _contianerBgView = [[UIView alloc] init];
        _contianerBgView.backgroundColor = SmallDecisionsSecondBgColor;
        _contianerBgView.layer.cornerRadius = 10;
        [self.contentView addSubview:_contianerBgView];
        [_contianerBgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(20);
            make.right.mas_equalTo(-20);
            make.top.mas_equalTo(5);
            make.bottom.mas_equalTo(-5);
        }];
    }
    
    return _contianerBgView;
}

- (SmallDecisionsTextField *)textField {
    if(!_textField) {
        _textField = [[SmallDecisionsTextField alloc] init];
        _textField.textColor = SmallDecisionsThemeFontColor;
        _textField.placeholder = @"请输入选项";
        _textField.font = SmallDecisionsSetFontSize(14);
        [self.contianerBgView addSubview:_textField];
        [_textField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(0);
            make.bottom.mas_equalTo(0).priorityHigh();
            make.height.mas_equalTo(56);
            make.left.mas_equalTo(15);
            make.right.mas_equalTo(-15);
        }];
    }
    return _textField;
}

@end
